//
// Created by Zsir on 2025/7/29.
//

#ifndef HTTP_HTTP_H
#define HTTP_HTTP_H

#define BUFFER_SIZE 4096
#define HTTP_VERSION "HTTP/1.1"
#define CONNECTION_TYPE "Connection: close\r\n"

class HTTP
{
public:

    explicit HTTP(const char *hostname, int port = 80);

    int connect();

    char *sendRequest(const char *resource);

private:
    void hostToIp();

    const char *hostname_;
    int port_;
    struct hostent *host_{};
    char *ip_{};
    int sockfd_{};
};


#endif //HTTP_HTTP_H
